package core

import "testing"

func TestBoolean001(t *testing.T) {
	b := BooleanNode{Token{BOOLEAN, "#t", 1, 2}, true}
	if b.Type() != BOOLEAN_NODE {
		t.Errorf("Boolean.Type() should be %s, but %s", BOOLEAN_NODE, b.Type())
	}
	if b.String() != "#t" {
		t.Errorf("Boolean.Inspect() should be %s, but %s", "#t", b.String())
	}
}

func TestBoolean002(t *testing.T) {
	b := BooleanNode{Token{BOOLEAN, "#f", 1, 2}, false}
	if b.Type() != BOOLEAN_NODE {
		t.Errorf("Boolean.Type() should be %s, but %s", BOOLEAN_NODE, b.Type())
	}
	if b.String() != "#f" {
		t.Errorf("Boolean.Inspect() should be %s, but %s", "#f", b.String())
	}
}

func TestSymbol001(t *testing.T) {
	s := SymbolNode{Token{SYMBOL, "define", 1, 2}, "define"}
	if s.Type() != SYMBOL_NODE {
		t.Errorf("Symbol.Type() should be %s, but %s", SYMBOL_NODE, s.Type())
	}
	if s.String() != "define" {
		t.Errorf("Symbol.Inspect() should be %s, but %s", "define", s.String())
	}
}

func TestList001(t *testing.T) {
	define := Token{SYMBOL, "define", 1, 2}
	x := Token{SYMBOL, "x", 1, 2}
	exp := Token{SYMBOL, "#t", 1, 2}
	l := ListNode{[]Node{&SymbolNode{define, "define"}, &SymbolNode{x, "x"}, &BooleanNode{exp, true}}}
	if l.Type() != LIST_NODE {
		t.Errorf("List.Type() should be %s, but %s", LIST_NODE, l.Type())
	}
	if l.String() != "(define x #t)" {
		t.Errorf("List.Inspect() should be %s, but %s", "(define x true)", l.String())
	}
}
